package com.css.fxfzxczh.modules.aftershockSequence.controller;

import com.css.fxfzxczh.base.response.RestResponse;
import com.css.fxfzxczh.modules.aftershockSequence.entity.AftershockSequence;
import com.css.fxfzxczh.modules.aftershockSequence.service.AftershockSequenceService;
import com.css.fxfzxczh.modules.aftershockSequence.vo.AftershockSequenceVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/aftershockSequence")
@Slf4j
public class AftershockSequenceController {


    @Resource
    private AftershockSequenceService aftershockSequenceService;

    @GetMapping("/getAftershockSequenceData")
    public RestResponse getAftershockSequenceData(AftershockSequenceVO aftershockSequenceVO){
        RestResponse restResponse=null;
        try {

            List<AftershockSequence> list=aftershockSequenceService.getAftershockSequenceData(aftershockSequenceVO);
            restResponse=RestResponse.succeed(list);
        }catch (Exception e){
            String errormessage = e.getMessage();
            if(StringUtils.isBlank(errormessage)) {
                errormessage = "查询失败";
            }
            log.error(errormessage,e);
            restResponse=RestResponse.fail(errormessage);
        }
        return restResponse;
    }
}
